refactor(rules/font_face): change supports to tech#255
refactor(rules/font_face): change supports to tech#255devongovett merged 12 commits intoparcel-bundler:masterfrom
Conversation
|
Thanks, will look closer tomorrow.
Yeah, if a property fails to parse, it is stored as raw tokens. This way, if a new feature is added that we don't support yet, we don't fail to parse, it'll just potentially be less optimally minified. I think eventually we might have a strict mode to fail in this case, and we might also emit warnings otherwise. |
baff794 to
59afc6d
Compare
5c94198 to
1a0a041
Compare
|
I think it's ready to merge, please take a look |
src/rules/font_face.rs
Outdated
| location: input.current_source_location(), | ||
| }); | ||
| } | ||
| } |
There was a problem hiding this comment.
How could these errors ever happen? format_location will always be less than tech_location since you already parsed it before if it exists.
src/rules/font_face.rs
Outdated
| let tech_len = self.tech.len(); | ||
| if tech_len > 0 { |
There was a problem hiding this comment.
| let tech_len = self.tech.len(); | |
| if tech_len > 0 { | |
| if !self.tech.is_empty() { |
src/rules/font_face.rs
Outdated
| for i in 0..tech_len { | ||
| self.tech[i].to_css(dest)?; | ||
| if tech_len - 1 != i { | ||
| dest.write_char(',')?; | ||
| } | ||
| technology.to_css(dest)?; | ||
| } |
There was a problem hiding this comment.
you can do self.tech.to_css(dest)?; here - Vec implements the ToCss trait if its contents does.
src/rules/font_face.rs
Outdated
| serde(tag = "type", content = "value", rename_all = "kebab-case") | ||
| serde(tag = "type", content = "value") | ||
| )] | ||
| pub enum FontTechnology { |
There was a problem hiding this comment.
You could probably use the enum_property macro to simplify this if you want. It would implement Parse and ToCss for you.
…dd more spec links.
7f7b9b6 to
32f65d3
Compare
Closes: #254
https://github.com/parcel-bundler/parcel-css/blob/5a6801ce26f9ae9d07d44d3427de4a6b48663261/src/lib.rs#L9425-L9430
should we have this test, if we should, please tell me how to make it pass correctly, thanks
I tried to propagate the error up
https://github.com/parcel-bundler/parcel-css/blob/5a6801ce26f9ae9d07d44d3427de4a6b48663261/src/rules/font_face.rs#L70-L85
But here the error have been ignored again
https://github.com/parcel-bundler/parcel-css/blob/5a6801ce26f9ae9d07d44d3427de4a6b48663261/src/rules/font_face.rs#L430-L435